﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.Net.Sockets;
using System.Net.NetworkInformation;


namespace NetSnoop
{

    class CNetHelper
    {

        private IPGlobalProperties ipGlobal = IPGlobalProperties.GetIPGlobalProperties();

        public TcpConnectionInformation[] GetTCPConnection()
        {
                      
            // create array of tcp connections and retrieve active connections
            TcpConnectionInformation[] tcpActiveConnections = ipGlobal.GetActiveTcpConnections();

            return tcpActiveConnections;
            
        }

        public IPEndPoint[] GetTCPListener()
        {
            // create array of tcp connections and retrieve active listeners
            IPEndPoint[] tcpActiveListeners = ipGlobal.GetActiveTcpListeners();

            return tcpActiveListeners;
        }

    }
}
